home *** CD-ROM | disk | FTP | other *** search
/ Champak 114 / Vol 114.iso / games / park_thi.swf / scripts / DefineSprite_227_clip18 / frame_1 / DoAction.as < prev   
Encoding:
Text File  |  2010-08-12  |  629 b   |  31 lines

  1. var target;
  2. var attackRate = 25;
  3. var timer = 0;
  4. var health = 100;
  5. stop();
  6. onEnterFrame = function()
  7. {
  8.    if(_root.userCar == "")
  9.    {
  10.       target = _parent.valet_mc;
  11.    }
  12.    else
  13.    {
  14.       target = _parent[_root.userCar];
  15.    }
  16.    this._rotation = Math.atan2(this._y - target._y,this._x - target._x) * 180 / 3.141592653589793;
  17.    if(_currentframe == 1)
  18.    {
  19.       gotoAndStop(3);
  20.    }
  21.    if(_root.userCar != "")
  22.    {
  23.       if(this.hitTest(target) && this._currentframe != _totalframes)
  24.       {
  25.          target._name = "car0_mc";
  26.          target.health = 0;
  27.          gotoAndStop(4);
  28.       }
  29.    }
  30. };
  31.